$args = array( 'category_name' => 'cat1', 'posts_per_page' => 5, 'orderby' => 'rand', ); $pc = new WP_Query( $args );